/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package acceso.aplicacion;

import java.util.ArrayList;
import java.util.List;
import java.util.Properties;

/**
 *
 * @author Rómulo Galindo Tanta
 */
public class Workflow {

    private String color;
    private String modini;
    private String host;
    private String cookie_name;
    private boolean filter;
    private boolean replicacion;
    //private boolean push;
    //private boolean demanda;
    private boolean logueo;
    private List<Link> links = new ArrayList<>();
    
    private boolean master_login;
    private String master_login_url;
    private String master_login_cookie_domain;

    public Workflow(Properties properties) {
        color = properties.getProperty("workflow.color");
        modini = properties.getProperty("workflow.modini");
        host = properties.getProperty("workflow.host");
        filter = Boolean.parseBoolean(properties.getProperty("workflow.filter"));
        replicacion = Boolean.parseBoolean(properties.getProperty("workflow.replicacion"));
//        push = Boolean.parseBoolean(properties.getProperty("workflow.push"));
//        demanda = Boolean.parseBoolean(properties.getProperty("workflow.demanda"));
        logueo = Boolean.parseBoolean(properties.getProperty("workflow.logueo"));
        cookie_name = properties.getProperty("workflow.login.cookie.name");
        //--especial de datos de links
        String[] ls = new String[0];
        try{
            ls = properties.getProperty("workflow.applink.ids").split(",");
//            System.out.println(">>>"+ls);
//            System.out.println(">>>"+ls.length);
        }catch(Exception ep){
            ls = new String[0];
        }
        
        for (String l : ls) {
            links.add(new Link(properties.getProperty("workflow.applink.id." + l), properties.getProperty("workflow.applink.name." + l), properties.getProperty("workflow.applink.url." + l)));
        }
        //---------------------------------------------------
        master_login = Boolean.parseBoolean(properties.getProperty("workflow.master_login"));
        master_login_url = properties.getProperty("workflow.master_login_url");
        master_login_cookie_domain = properties.getProperty("workflow.master_login_cookie_domain");
        
    }

    public Workflow() {
        color = "blue";
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public String getModini() {
        return modini;
    }

    public void setModini(String modini) {
        this.modini = modini;
    }

    public String getHost() {
        return host;
    }

    public void setHost(String host) {
        this.host = host;
    }

    public boolean isFilter() {
        return filter;
    }

    public void setFilter(boolean filter) {
        this.filter = filter;
    }

    public boolean isReplicacion() {
        return replicacion;
    }

    public void setReplicacion(boolean replicacion) {
        this.replicacion = replicacion;
    }

//    public boolean isPush() {
//        return push;
//    }
//
//    public void setPush(boolean push) {
//        this.push = push;
//    }
//
//    public boolean isDemanda() {
//        return demanda;
//    }
//
//    public void setDemanda(boolean demanda) {
//        this.demanda = demanda;
//    }

    public boolean isLogueo() {
        return logueo;
    }

    public void setLogueo(boolean logueo) {
        this.logueo = logueo;
    }

    public List<Link> getLinks() {
        return links;
    }

    public void setLinks(List<Link> links) {
        this.links = links;
    }

    public boolean isMaster_login() {
        return master_login;
    }

    public void setMaster_login(boolean master_login) {
        this.master_login = master_login;
    }

    public String getMaster_login_url() {
        return master_login_url;
    }

    public void setMaster_login_url(String master_login_url) {
        this.master_login_url = master_login_url;
    }

    public String getMaster_login_cookie_domain() {
        return master_login_cookie_domain;
    }

    public void setMaster_login_cookie_domain(String master_login_cookie_domain) {
        this.master_login_cookie_domain = master_login_cookie_domain;
    }

    public String getCookie_name() {
        return cookie_name;
    }

    public void setCookie_name(String cookie_name) {
        this.cookie_name = cookie_name;
    }
    
    
    
}
